
#ifndef		PARAM_READER_H
#define		PARAM_READER_H

#include <fstream>

//reads param file 
class ParamReader
{
public:

	static bool load(const char* fname); 
	static void print(); 

	//Experiment	
	static int		EXP_NUM_RUNS;						//number of trials (for statistical significant)
	static int		EXP_NUM_EPISODES;					//number of episodes in each run
	static int		EXP_NUM_STEPS;						//max number of steps in each episode
	static int		EXP_TYPE;							//type of experiment: (0) planning, (1) offline learning, (2) online learning	


	//MRE Agent
	static int		AGNT_USE_GENERALIZATION_TIME;		// time when we start using generalization
	static int		AGNT_USE_GENERALIZATION_END_TIME;	// time we stop using generalization
	static bool		AGNT_USE_GENERALIZATION		;				// are we using generalization or not
	static bool		AGNT_LEARN_GENERALIZATION	; //
	static int		AGNT_LEARN_GENERALIZATION_END_TIME	; 
	static int		AGNT_SOLVE_PERIOD			;			//interval for solving our model
	static int		AGNT_BATCH_LEARNING_TIME	;		//at what intervals do we rerun the whole history for our transition function gen. 
	static int		AGNT_BATCH_LEARNING_END_TIME;		//when do we stop batch learning (-1 for do not stop)
	static int		AGNT_RUN_TIMEOUT			;		//number of seconds till we kill one of actions (see the code)
	static double	GAMMA						; //param:
	static double	rmax						;		//param:	
	static bool		LOAD_MODEL					;		//whether load the previous experience or not 
	static bool		SAVE_MODEL					;		//whether save the state to be used later


	//planners
	static double	PLN_VI_EPSILON				;		//in value iteration, what is the termination criterion
	static int		GRD_DISCRETIZED_SIZE		; 		//how many cells per continuous dimension should we have
	static int		GRD_EST_SAMPLE_SIZE			;				// number of samples we pick from our generalizers when we try to appx a transition
	//FVI and monte carlo planners
	static int		FVI_DISCRETIZED_SIZE		;		//how many samples per dimension
	static int		FVI_MC_LENGTH				;		//how deep the monte carlo rollouts are 
	static int		FVI_BACKUP_SAMPLES			;       	

private:
	static int readInt(const char* name, int& value);
	static double readDouble(const char* name, double& value); 
	static char* readString(const char* name, char*& value); 
	static bool readBool(const char* name, bool& value); 

	static std::ifstream cfgFile; 
	static bool skip2param(const char* tag);
	static char getNextChar(std::ifstream& cfg); 

};



#endif
